<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        var age = 5;
        if (age < 12) {
            console.warn('Sorry! This game is for children above 12 years.');
            alert('Sorry! This game is for children above 12 years.');
        } else {
            console.log('Play the game.');
            alert('Play the game.');
        }
    </script>

</body>

</html>

<!-- if ... else 语句 -->
<!-- https://developer.mozilla.org/zh-CN/docs/Learn/JavaScript/Building_blocks/conditionals#if_..._else_%E8%AF%AD%E5%8F%A5 -->

<!-- if...else -->
<!-- https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/if...else -->